﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="shipu_clone05.aspx.cs"
    Inherits="Catering.Catering_Page.Caipin.Caipin_jcsz.shipu_clone05" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link rel="stylesheet" type="text/css" href="../../../Style/head.css" />
    <link rel="stylesheet" type="text/css" href="../../../Style/center.css" /> 
    <link rel="stylesheet" type="text/css" href="../../../Style/jquery.treeview.css" />
    <link rel="stylesheet" type="text/css" href="../../../Style/contextmenu.css" />
    <link href="../../../Style/jquery-ui-1.10.1.custom.min.css" rel="stylesheet" type="text/css" />
    <script src="../../../Scripts/jquery-1.9.1.js" type="text/javascript"></script>
    <script src="../../../Scripts/recipe.js" type="text/javascript"></script>
    <script src="../../../Scripts/jquery-ui-1.10.1.custom.min.js" type="text/javascript"></script>
    <script src="../../../Scripts/wait.js" type="text/javascript"></script>
    <link href="shipuCss/ShipuStyle.css" rel="stylesheet" type="text/css" />
    <script src="/Scripts/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
    <script src="/Catering_Page/Caipin/Caipin_jcsz/RecipeJs/ImpRecipe.js" type="text/javascript"></script>
    <script src="/Catering_Page/Caipin/Caipin_jcsz/RecipeJs/JSExportExecl.js" type="text/javascript"></script>

</head>
<script type="text/javascript">
    var add_fmid; //FMID
    var dishid = '<%=m_dishid %>'; //菜谱
    var add_dayofweek = 1; //周几(0为周日)
    $(document).ready(function () {
        if ('<%=m_recipesid %>' != '0') showwait(5); //暂停5秒
        $(document).bind("selectstart", function () { return false; }); //禁止选择
        $('table.pc_l>tbody>tr:even').css("background", "#dbf4df");
        //初始化菜谱
        LoadDishInfo(dishid);

        $("#pc_box>div").hide();
        inittab(); //选项卡单击切换

        //绑定每天初始化菜单数据
        for (var i = parseInt('<%=m_daybyweek %>'); i > 0; i--) {
            getdishraw(i);
        }
        //显示星期一菜单
        $("#pc_ui>ul>li:gt(" + parseInt('<%=m_daybyweek %>') + ")").css("display", "none");
        $("#pc_ui>ul>li").removeClass("on");
        $("#pc_ui>ul>li:eq(1)").addClass("on");
        $("#pc_box>div:eq(1)").show();
        //显示经济评价及安全提示
        GetRecipesPrice(1);
        CheckDishRepeat();

        /*加载元素信息*/
        InitElementsTab();
        InitElements();

        $(document).mousemove(function (event) {
            if ($("#cai_info").css("display") == "block") {
                $("#cai_info").css({ left: event.pageX + 5 + 'px', top: event.pageY + 5 + 'px' });
            }
        });

        //周变换事件
        $('#pc_week').change(function () {
            location.href = "shipu_clone05.aspx?cid=<%=m_recipesid %>&weekno=" + $(this).get(0).selectedIndex + "&dishid=" + dishid;
        });

        $(document).mouseup(function () {
            if ($('#cai_info').css("display") == "none") return;
            $("#cai_info").css("display", "none");
            var selected_id = $("#cai_info td[name='id']").text(); //菜ID
            var fmid = add_fmid; //餐别
            var dofw = add_dayofweek; //第几天
            var weeknoid = $("#pc_week").val(); //周
            var recipeid = "<%=m_recipesid %>"; //食谱ID
            if (CheckID(selected_id, false) && CheckID(fmid, false) && CheckID(dofw, true) && CheckID(weeknoid, false) && CheckID(recipeid, false)) {
                $.ajax({
                    type: "Post",
                    url: "shipu_clone05.aspx/AddDish",
                    data: "{'DishID':'" + selected_id + "','FMID':'" + fmid + "','DayOfWeek':'" + dofw + "','WeekNoID':'" + weeknoid + "','RecipesID':'" + recipeid + "'}",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function (data) {
                        if (data.d == "NOCLASS") {
                            alert("您所在的班组尚未配置配送区域！");
                            return;
                        }
                        else if (data.d == "NOROW") {
                            alert("您所在的配送区域无此原料！");
                            return;
                        }
                        var o = eval('(' + data.d + ')');
                        var rawstr = ""; //每天菜单
                        var tab0rawstr = ""; //全部菜单
                        var j = 0;
                        $(o.DishInfo).each(function () {
                            if (j == 0) {
                                rawstr += "<td>" + o.DishInfo[j].RawName + "</td><td align='right' type='number' typeid='" + o.DishInfo[j].AID + "'>" + o.DishInfo[j].Number + "</td><td rowspan='" + o.DishInfo.length + "' align='right'><a href=\"javascript:deldish('" + o.RecipeInformationID + "')\"><img alt='删除菜品' src='../../../Images/trash.gif' /></a></td></tr>";
                                tab0rawstr += "<td>" + o.DishInfo[j].RawName + "</td><td align='right'>" + o.DishInfo[j].Number + "</td></tr>";
                            }
                            else {
                                rawstr += "<tr><td>" + o.DishInfo[j].RawName + "</td><td align='right' type='number' typeid='" + o.DishInfo[j].AID + "'>" + o.DishInfo[j].Number + "</td></tr>";
                                tab0rawstr += "<tr><td>" + o.DishInfo[j].RawName + "</td><td align='right'>" + o.DishInfo[j].Number + "</td></tr>";
                            }
                            j++;
                        });
                        var str = "<table id='rinfo_" + o.RecipeInformationID + "' width='100%' onmouseover=\"this.style.backgroundColor='#D2EEFA'\" onmouseout=\"this.style.backgroundColor='transparent'\"><tr><td pd_cid='" + o.CID + "' pd_dtid='" + o.DTID + "' rowspan='" + o.DishInfo.length + "'>" + o.DishName + "</td>" + rawstr + "</table>";
                        var tab0str = "<table width='100%' onmouseover=\"this.style.backgroundColor='#D2EEFA'\" onmouseout=\"this.style.backgroundColor='transparent'\"><tr><td pd_cid='" + o.CID + "' pd_dtid='" + o.DTID + "' rowspan='" + o.DishInfo.length + "'>" + o.DishName + "</td>" + tab0rawstr + "</table>";
                        var q = $(str).find("td[type='number']").each(function () { $(this).bind("click", EditNumber); });
                        $($(q).parents("table")).appendTo($("#pc_x" + (dofw == 0 ? 7 : dofw) + ">table>tbody>tr:eq(" + (o.CanBie - 1) + ")>td:eq(1)"));
                        $(tab0str).appendTo($("#pc_tab0>table>tbody>tr:eq(" + (o.CanBie - 1) + ")>td:eq(" + (dofw == 0 ? 6 : (dofw - 1)) + ")"));
                        GetRecipesPrice(0);
                        CheckDishRepeat();
                    }
                });
            }
        });

        $("div[CaiID]").mouseover(function () {
        });

        $("tr[istz='true']").mouseover(function () {
            if ($('#cai_info').css("display") == "block") {
                add_fmid = $(this).attr("fmid");
            }
        });
    });
    function inittab() {
        $("#pc_ui>ul>li").each(function (i) {
            $(this).click((function (k) {
                return function () {
                    $("#pc_box>div").hide();
                    $("#pc_box>div:eq(" + k + ")").show();
                    $("#pc_ui>ul>li").removeClass("on");
                    $("#pc_ui>ul>li:eq(" + k + ")").addClass("on");
                    if (k > 0) {
                        var j = k == 7 ? 0 : k;
                        add_dayofweek = j;
                        CheckDishRepeat();
                        GetRecipesPrice(0);
                    }
                }
            })(i));
        });
    }

    function CheckDishRepeat() {
        if ('<%=m_recipesid %>' == '0') return;
        var i = add_dayofweek == 0 ? 7 : add_dayofweek;
        $.ajax({
            type: "Post",
            url: "shipu_clone05.aspx/GetRecipesRule",
            data: "{'recipes':'<%=m_recipesid %>'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data) {
                if (data.d == "") return;
                var o = eval('(' + data.d + ')');
                var j = 0;
                $(o.RuleInfo).each(function () {
                    var id = o.RuleInfo[j].DTID;
                    var no = o.RuleInfo[j].No;
                    var typeid = o.RuleInfo[j].RepeatType;
                    //每餐不可重复
                    $("div#pc_x" + i + ">table.pc_l>tbody>tr").each(function () {
                        var c = $(this);
                        c.find("td[pd_dtid='" + id + "']").each(function () {
                            var k = $(this).attr("pd_cid");
                            if (c.find("td[pd_dtid='" + id + "'][pd_cid='" + k + "']").length > 2) {
                                c.find("td[pd_dtid='" + id + "'][pd_cid='" + k + "']").css("color", "Red");
                            }
                            else {
                                c.find("td[pd_dtid='" + id + "'][pd_cid='" + k + "']").css("color", "#000");
                            }
                        });
                    });

                    if (typeid == 1) {//每天可重复
                        $("div#pc_x" + i + " td[pd_dtid='" + id + "']").each(function () {
                            var k = $(this).attr("pd_cid");
                            if ($("div#pc_x" + i + " td[pd_dtid='" + id + "'][pd_cid='" + k + "']").length > (parseInt(no) + 1)) {
                                $("div#pc_x" + i + " td[pd_dtid='" + id + "'][pd_cid='" + k + "']").css("color", "Red");
                            }
                            else {
                                $("div#pc_x" + i + " td[pd_dtid='" + id + "'][pd_cid='" + k + "']").css("color", "#000");
                            }
                        });
                    }
                    else {
                        $("div[id^='pc_x'] td[pd_dtid='" + id + "']").each(function () {
                            var k = $(this).attr("pd_cid");
                            if ($("div[id^='pc_x'] td[pd_dtid='" + id + "'][pd_cid='" + k + "']").length > (parseInt(no) + 1)) {
                                $("div[id^='pc_x'] td[pd_dtid='" + id + "'][pd_cid='" + k + "']").css("color", "Red");
                            }
                            else {
                                $("div[id^='pc_x'] td[pd_dtid='" + id + "'][pd_cid='" + k + "']").css("color", "#000");
                            }
                        });
                    }
                    j++;
                });
            }
        });
    }

    //添加本周每日菜品
    function getdishraw(i) {
        var weeknoid = $("#pc_week").val();
        $.ajax({
            type: "Post",
            url: "shipu_clone05.aspx/GetDishRawMater",
            data: "{'StrRecipeID':' <%=m_recipesid %>','StrWeekNoID':'" + weeknoid + "','StrDateNo':'" + (i == 7 ? 0 : i) + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data) {
                //                i = i == 0 ? 7 : i;
                var o = eval('(' + data.d + ')');
                $(o.TableInfo).each(function () {
                    var s = $(this);
                    var rawstr = "";
                    var tab0rawstr = "";
                    var j = 0;
                    $(s[0].DisInfo).each(function () {
                        if ('<%=m_canedit %>' == '1') {
                            if (j == 0) {
                                rawstr += "<td>" + s[0].DisInfo[j].RAWName + "</td><td align='right' type='number' typeid='" + s[0].DisInfo[j].AID + "'>" + s[0].DisInfo[j].Number + "</td><td rowspan='" + s[0].DisInfo.length + "' align='right'><a href=\"javascript:deldish('" + s[0].RecipeInformationID + "')\"><img alt='删除菜品' src='../../../Images/trash.gif' /></a></td></tr>";
                                tab0rawstr += "<td>" + s[0].DisInfo[j].RAWName + "</td><td align='right'>" + s[0].DisInfo[j].Number + "</td></tr>";
                            }
                            else {
                                rawstr += "<tr><td>" + s[0].DisInfo[j].RAWName + "</td><td align='right' type='number' typeid='" + s[0].DisInfo[j].AID + "'>" + s[0].DisInfo[j].Number + "</td></tr>";
                                tab0rawstr += "<tr><td>" + s[0].DisInfo[j].RAWName + "</td><td align='right'>" + s[0].DisInfo[j].Number + "</td></tr>";
                            }
                        }
                        else {
                            if (j == 0) {
                                rawstr += "<td>" + s[0].DisInfo[j].RAWName + "</td><td align='right'>" + s[0].DisInfo[j].Number + "</td></tr>";
                            }
                            else {
                                rawstr += "<tr><td>" + s[0].DisInfo[j].RAWName + "</td><td align='right'>" + s[0].DisInfo[j].Number + "</td></tr>";
                            }
                        }
                        j++;
                    });
                    if ('<%=m_canedit %>' == '1') {
                        var str = "<table id='rinfo_" + s[0].RecipeInformationID + "' width='100%' onmouseover=\"this.style.backgroundColor='#D2EEFA'\" onmouseout=\"this.style.backgroundColor='transparent'\"><tr><td pd_cid='" + s[0].CID + "' pd_dtid='" + s[0].DTID + "' rowspan='" + s[0].DisInfo.length + "'>" + s[0].DishName + "</td>" + rawstr + "</table>";
                        var tab0str = "<table width='100%' onmouseover=\"this.style.backgroundColor='#D2EEFA'\" onmouseout=\"this.style.backgroundColor='transparent'\"><tr><td rowspan='" + s[0].DisInfo.length + "'>" + s[0].DishName + "</td>" + tab0rawstr + "</table>";
                        var q = $(str).find("td[type='number']").each(function () { $(this).bind("click", EditNumber); });
                        $($(q).parents("table")).appendTo($("#pc_x" + i + ">table>tbody>tr:eq(" + (s[0].CanBie - 1) + ")>td:eq(1)"));
                        $(tab0str).appendTo($("#pc_tab0>table>tbody>tr:eq(" + (s[0].CanBie - 1) + ")>td:eq(" + (i - 1) + ")"));
                    } else {
                        var str = "<table id='rinfo_" + s[0].RecipeInformationID + "' width='100%' onmouseover=\"this.style.backgroundColor='#D2EEFA'\" onmouseout=\"this.style.backgroundColor='transparent'\"><tr><td pd_cid='" + s[0].CID + "' pd_dtid='" + s[0].DTID + "' rowspan='" + s[0].DisInfo.length + "'>" + s[0].DishName + "</td>" + rawstr + "</table>";
                        $(str).appendTo($("#pc_x" + i + ">table>tbody>tr:eq(" + (s[0].CanBie - 1) + ")>td:eq(1)"));
                        $(str).appendTo($("#pc_tab0>table>tbody>tr:eq(" + (s[0].CanBie - 1) + ")>td:eq(" + (i - 1) + ")"));
                    }
                });
            }
        });
    }

    //删除菜品
    function deldish(id) {
        if (confirm("您确定要删除！")) {
            $("#rinfo_" + id).remove();
            $("#rinfo_" + id).remove();
            $.ajax({
                type: "Post",
                url: "shipu_clone05.aspx/DelDish",
                data: "{'RecipeInformationID':'" + id + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    if (data.d == "OK") {
                        GetRecipesPrice(0);
                        CheckDishRepeat();
                        alert("删除成功！");
                    }
                }
            });
        }
    }

    //编辑数量
    function EditNumber() {
        var box = $("<input type=\"text\" infomation=\"" + $(this).attr("typeid") + "\" value=\"" + $(this)[0].innerText + "\" style=\"width:30px;\" />");
        box.bind("focusout", SetNumber);
        $(this).text("").append(box);
        box.focus();
        box.select();
    }

    //修改数量
    function SetNumber(evt) {
        var num = $(this).val();
        if (num == "" || isNaN(num) || num == 0) {
            alert("请输入正确的数量！");
            $(this).focus();
            $(this).select();
            return;
        };
        var typeid = $(this).attr("infomation");
        $(this).parent().text(num);
        $.ajax({
            type: "Post",
            url: "shipu_clone05.aspx/ModifyDish",
            data: "{'RecipeInformationInfoID':'" + typeid + "','Number':'" + num + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data) {
                GetRecipesPrice(0);
                CheckDishRepeat();
            }
        });
    }

    //加载食谱库对应的菜
    function LoadDishInfo(libraryID) {
        if ('<%=m_recipesid %>' == '0') return;
        $("#hf_libraryID").val(libraryID);
        var size = 3;
        $.ajax({
            type: "Post",
            url: "shipu_clone05.aspx/GetDishInfoByLish",
            data: "{'Lid':'" + libraryID + "','StrRecipesID':'<%=m_recipesid %>','StrIndex':'0','StrSize':'" + size + "','StrDishNum':'0'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data) {
                $("#Dish_List").html(data.d[0]);
                var isend = data.d[4];
                if (isend == 0) {
                    var endindex = data.d[3];
                    LoadDishInfoNext(libraryID, endindex, size, data.d[1]);
                }
                else {
                    $("#dishNum").html("(" + data.d[1] + ")");
                    $("#library_Name").text(data.d[2]);
                    if ('<%=m_canedit %>' == '1') {
                        DishBing();
                    }
                }
            },
            error: function (ss, dd, oo) { alert(oo); }
        });

    }

    //绑定菜拖拽事件
    var IsTZ = false;
    function DishBing() {
        var uid = "1";
        $("#Dish_List a[IsCai='false']").click(function () {
            $(this).next().toggleClass("display_none");
            //单步加载该类别下的菜品
            if ($(this).attr("isload") == "false") { //判断该分类下面的菜品是否已经加载完毕
                $(this).attr("isload", "true");
                $(this).append("<img src='/Images/ajax-loader.gif' width='16' height='16' style='vertical-align:middle;'/>");
                var libraryID = $("#hf_libraryID").val();           //菜谱ID
                var RecipesID = "<%=m_recipesid %>"; //$("#hf_recipesid").val();           //食谱ID
                var DishTypeID = $(this).attr("typeid");            //类别ID
                $.ajax({
                    type: "Post",
                    url: "shipu_clone05.aspx/GetDishListByTypeID",
                    data: "{'Lid':'" + libraryID + "','StrRecipesID':'" + RecipesID + "','DishTypeID':'" + DishTypeID + "'}",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: function (data) {
                        if (data.d[0] == "OK") {
                            var obj = eval(data.d[1]);
                            var DishHtmlList = "";
                            $(obj).each(function (index) {
                                var DishItem = obj[index];
                                DishHtmlList += "<li><a iscai='true' uid='" + DishItem.id + "'>" + DishItem.Name + "</a></li>";
                            });
                            $("#Dish_List a[IsCai='false'][typeid='" + DishTypeID + "']").find("img").remove();
                            $("#Dish_List a[IsCai='false'][typeid='" + DishTypeID + "']").next().append(DishHtmlList);
                            //调用查询事件
                            SearchKey();

                            //注册事件
                            $("#Dish_List a[IsCai='false'][typeid='" + DishTypeID + "']").next().find("a[IsCai='true']").click(function () { return; });
                            $("#Dish_List a[IsCai='false'][typeid='" + DishTypeID + "']").next().find("a[IsCai='true']").mousedown(function (event) {
                                uid = $(this).attr("uid");
                                $.ajax({
                                    type: "Post",
                                    url: "shipu_clone05.aspx/CaiPin_Info_Tedian",
                                    data: "{'Dish_ID':'" + uid + " '}",
                                    contentType: "application/json; charset=utf-8",
                                    dataType: "json",
                                    success: function (data) {
                                        var strHtml = "<tr><td name=\"id\" style=\"display:none;\"  colspan=\"2\">" + uid + "</td></tr>" +
                                      "<tr><td colspan=\"2\">" + data.d[0] + "</td></tr>" +
                                      "<tr><td style=\"width:80px\">热量(千卡):</td><td>" + data.d[1] + "</td></tr>" +
                                      "<tr><td>蛋白质(克):</td><td>" + data.d[2] + "</td></tr>" +
                                      "<tr><td>脂肪(克):</td><td>" + data.d[3] + "</td></tr>" +
                                      "<tr><td>特点:</td><td>" + data.d[4] + "</td></tr>";
                                        var strTablehtml = "<table width=\"100%\"><tbody>" + strHtml + "</tbody></table>";
                                        $("#cai_info").html(strTablehtml);
                                        $("#cai_info").css("display", "block");
                                        $("#cai_info").css({ left: event.pageX + 5 + 'px', top: event.pageY + 5 + 'px' });
                                        IsTZ = true;
                                    }
                                });
                            });
                        }
                    },
                    error: function (ss, dd, oo) { alert(oo); }
                });
            }
        });
    }

    function CheckID(id, iszero) {
        if (!isNaN(id)) {
            if (!iszero && id == 0) return false;
            return true;
        }
        return false;
    }

    function GetRecipesPrice(k) {
        k = add_dayofweek > 0 ? add_dayofweek : 7;
        var recipeid = "<%=m_recipesid %>";
        var weeknoid = $("#pc_week").val();
        $.ajax({
            type: "Post",
            url: "shipu_clone05.aspx/GetRecipesPrice",
            data: "{'StrRecipesID':'" + recipeid + "','StrWeekNoID':'" + weeknoid + "','StrDayOfWeek':'" + add_dayofweek + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data) {
                $("#recipesprice_" + k).html("");
                $("#recipessafe_" + k).html("");
                $("#pc_j_" + k + " dt[rawtype^='shiwu_']").html("0g");
                if ($(data.d).length == 3) {
                    $("#recipesprice_" + k).html(data.d[0]);
                    $("#recipessafe_" + k).html(data.d[1]);
                    var n = 0;
                    $(data.d[2]).each(function () {
                        $("#pc_j_" + k + " dt[rawtype='shiwu_" + data.d[2][n].Key + "']").attr("rawtypevalue",data.d[2][n].Value);
                        $("#pc_j_" + k + " dt[rawtype='shiwu_" + data.d[2][n].Key + "']").html(data.d[2][n].Value+"g");
                        n++;
                    });
                }
            }
        });
    }

</script>
<script type="text/javascript">
    var curel_tab = 0;
    function InitElements() {
        $("div#ys_container_ui table tbody").empty();
        $.ajax({
            type: "Post",
            url: "shipu_clone05.aspx/GetNElements",
            data: "",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data) {
                var o = eval('(' + data.d + ')');
                $(o.ElementInfo).each(function (k) {
                    var s = "<tr EID=\"tr_NE_" + o.ElementInfo[k].id + "\"><td>" + o.ElementInfo[k].Elements + "(" + o.ElementInfo[k].Company + ")</td><td cid=\"Total\"></td><td cid=\"WeekPJ\"></td><td cid=\"WeekBL\"></td><td cid=\"DayNum\"></td><td cid=\"DayBL\"></td></tr>";
                    $(s).appendTo($("div#ys_container_ui_0 table tbody"));
                    if (o.ElementInfo[k].id == 1) {
                        var s1 = "<tr EID=\"tr_NE2_" + o.ElementInfo[k].id + "\"><td>" + o.ElementInfo[k].Elements + "(千僬)</td><td cid=\"Total\"></td><td cid=\"WeekPJ\"></td><td cid=\"WeekBL\"></td><td cid=\"DayNum\"></td><td cid=\"DayBL\"></td></tr>";
                        $(s1).appendTo($("div#ys_container_ui_0 table tbody"));
                    }
                });
                $("<tr><td colspan='6'>不足：<span style='color: #068ee5'>比率&lt;80%</span>过量：<span style='color: #f1116a'>比率&gt;120%</span>适量：<span>比率80%~120%</span></td></tr>").appendTo($("div#ys_container_ui_0 table tbody"));
            }
        });
    }

    function InitElementsTab() {
        $("#ys_title_ui>li").each(function (i) {
            $(this).click((function (k) {
                return function () {
                    $("#ys_title_ui>li").removeClass("on");
                    $("#ys_title_ui>li:eq(" + k + ")").addClass("on");
                    $("#e_main>div").hide();
                    $("#e_main>div:eq(" + k + ")").show();
                    ActiveTab(k);
                }
            })(i));
        });
        $("#e_main>div").hide();
        $("#e_main>div:eq(0)").show();
    }

</script>
<!--复制食谱-->
<script type="text/javascript">
    $(function () {
        //复制食谱
        $("#dialog6").dialog({
            autoOpen: false,
            width: 600,
            buttons: [
				{
				    text: "确定",
				    click: function () {
				        if (!confirm("复制该食谱会清空本周所选的全部菜品，确定复制？")) {
				            return;
				        }

				        if ($(".SearchRecipesListCopy tr[IsSelected='True']").length > 0) {
				            var RecipesID = "<%=m_recipesid %>";
				            var RecipesWeekID = $("#pc_week").val();
				            var weekno = $("#pc_week option:selected").index();
				            var CopyRecipesWeekID = $(".SearchRecipesListCopy tr[IsSelected='True']").find("select option:selected").attr("recipesweekid");
				            $.ajax({
				                type: "Post",
				                url: "shipu_clone05.aspx/CopyRecipes",
				                data: "{'RecipesWeekID':'" + RecipesWeekID + "','CopyRecipesWeekID':'" + CopyRecipesWeekID + "'}",
				                contentType: "application/json; charset=utf-8",
				                dataType: "json",
				                success: function (data) {
				                    if (data.d[0] == "OK") {
				                        alert("复制成功！");
				                        window.location.href = "shipu_clone05.aspx?cid=" + RecipesID + "&weekno=" + weekno;
				                    }
				                }
				            });


				        }
				        else {
				            alert("请选择要导入的食谱！");
				        }
				    }
				},
                {
                    text: "关闭",
                    click: function () {
                        $(this).dialog("close");
                    }
                }
			]
        });

        //复制食谱列表点击事件
            $(".SearchRecipesListCopy tr").click(function () {
            $(".SearchRecipesListCopy tr").css("background-color", "#fff").attr("IsSelected", "False");
            $(this).css("background-color", "#999").attr("IsSelected", "True");
        });
    });
        
    function CopyRecipes() {
        $("#dialog6").dialog("open");
    }
</script>

<script type="text/javascript">
    $(function () {
        $("#dialog").dialog({
            autoOpen: false,
            width: 500,
            buttons: [
				{
				    text: "关闭",
				    click: function () {
				        $(this).dialog("close");
				        for (var i = 1; i < 5; i++) {
				            $("div#ys_container_ui_" + i + " table tbody").html("");
				        }
				    }
				}
			]
        });
        $("#dialog1").dialog({
            autoOpen: false,
            width: 600,
            buttons: [
				{
				    text: "确定",
				    click: function () {
				        if (CheckID($("#hf_recipesid").val(), false)) {
				            var o = $(".SearchRecipesList tr[cid='" + $("#hf_recipesid").val() + "']");
				            $("#hf_weekNo").val(o.find("select").get(0).selectedIndex);
				            $("#Recipes_List").click();
				        }
				        else {
				            alert("请选择要导入的食谱！");
				        }
				    }
				},
                {
                    text: "关闭",
                    click: function () {
                        $(this).dialog("close");
                    }
                }
			]
            });

        $("#dialog5").dialog({
            autoOpen: false,
            width: 200
        });
    });

    function ImportRecipes() {
        $("#dialog1").dialog("open");
    }

    
    function opendrag(n) {
        $("#dialog").dialog("open");
        //清空
        for (var i = 1; i < 5; i++) {
            $("div#ys_container_ui_" + i + " table tbody").html("");
        }

        //选项卡设置
        $("#e_main>div").hide();
        $("#e_main>div:eq(0)").show();
        $("#ys_title_ui>li").removeClass("on");
        $("#ys_title_ui>li:eq(0)").addClass("on");
        showwait(3);
        //初始化
        if (curel_tab == 0 && $("div#ys_container_ui_0 table tbody").html() == "") {
            InitElements();
        }
        ActiveTab(curel_tab);

        //日期
        var day = DateAddDay('<%=m_weekstart %>', add_dayofweek == 0 ? 6 : (add_dayofweek - 1));
        $("th[name='riqi']").html(day);
    }

    function ActiveTab(n) {
        if ($("div#ys_container_ui_" + n + " table tbody").html() == "" || $("div#ys_container_ui_" + n + " table tbody tr").length==0) {
            $("div#ys_container_ui_" + n + " table tbody").html($("div#ys_container_ui_0 table tbody").html());
        }
        else if (n > 0) {
            return;
        }
        var recipeid = "<%=m_recipesid %>"; //食谱ID
        var weeknoid = $("#pc_week").val(); //周
        $.ajax({
            type: "Post",
            url: "shipu_clone05.aspx/GetSheruliang",
            data: "{'StrRecipesID':'" + recipeid + "','StrWeekNoID':'" + weeknoid + "','StrDayOfWeek':'" + add_dayofweek + "','FMNO':'" + n + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data) {
                var DayCount = parseInt("<%=m_daybyweek %>");
                for (var i = 0; i < 24; i++) {

                    var totalDay = fomatFloat(data.d[0][i], 2); //每天标准摄入量
                    var total = totalDay * DayCount; //每周标准摄入量

                    var NumWeekBL = fomatFloat((parseFloat(data.d[1][i]) / total * 100).toString(), 2); //周比率
                    var NumDayBL = fomatFloat((parseFloat(data.d[2][i]) / totalDay * 100).toString(), 2); //天比率

                    $("div#ys_container_ui_" + n + " table tbody tr[EID='tr_NE_" + (i + 1) + "']").find("td[cid='Total']").text(totalDay); //每天标准摄入量
                    $("div#ys_container_ui_" + n + " table tbody tr[EID='tr_NE_" + (i + 1) + "']").find("td[cid='WeekPJ']").text(fomatFloat(data.d[1][i], 2)).css("color", GetTdColor(NumWeekBL));
                    $("div#ys_container_ui_" + n + " table tbody tr[EID='tr_NE_" + (i + 1) + "']").find("td[cid='WeekBL']").text((total == 0 ? "0" : NumWeekBL) + "%").css("color", GetTdColor(NumWeekBL));
                    $("div#ys_container_ui_" + n + " table tbody tr[EID='tr_NE_" + (i + 1) + "']").find("td[cid='DayNum']").text(fomatFloat(data.d[2][i], 2)).css("color", GetTdColor(NumDayBL));
                    $("div#ys_container_ui_" + n + " table tbody tr[EID='tr_NE_" + (i + 1) + "']").find("td[cid='DayBL']").text((total == 0 ? "0" : NumDayBL) + "%").css("color", GetTdColor(NumDayBL));
                }
                //热量千焦
                var totalDay_2 = fomatFloat(data.d[0][0] * 4.182, 2);
                var total_2 = totalDay_2 * DayCount;
                var NumWeekBL_2 = fomatFloat((parseFloat(data.d[1][0] * 4.182) / total_2 * 100).toString(), 2);
                var NumDayBL_2 = fomatFloat((parseFloat(data.d[2][0] * 4.182) / totalDay_2 * 100).toString(), 2);
                $("div#ys_container_ui_" + n + " table tbody tr[EID='tr_NE2_1']").find("td[cid='Total']").text(totalDay_2);
                $("div#ys_container_ui_" + n + " table tbody tr[EID='tr_NE2_1']").find("td[cid='WeekPJ']").text(fomatFloat(data.d[1][0] * 4.182, 2)).css("color", GetTdColor(NumWeekBL_2));
                $("div#ys_container_ui_" + n + " table tbody tr[EID='tr_NE2_1']").find("td[cid='WeekBL']").text((total_2 == 0 ? "0" : NumWeekBL_2) + "%").css("color", GetTdColor(NumWeekBL_2));
                $("div#ys_container_ui_" + n + " table tbody tr[EID='tr_NE2_1']").find("td[cid='DayNum']").text(fomatFloat(data.d[2][0] * 4.182, 2)).css("color", GetTdColor(NumDayBL_2));
                $("div#ys_container_ui_" + n + " table tbody tr[EID='tr_NE2_1']").find("td[cid='DayBL']").text((total_2 == 0 ? "0" : NumDayBL_2) + "%").css("color", GetTdColor(NumDayBL_2));
            }
        });
    }

    function fomatFloat(src, pos) {
        return Math.round(src * Math.pow(10, pos)) / Math.pow(10, pos);
    }

    function GetTdColor(num) {
        if (num < 80) {
            return "#068EE5";
        }
        else if (num > 120) {
            return "#f1116a";
        }
        else {
            return "#000";
        }
    }
</script>
<!--列表样式控制-->
<script type="text/javascript">
    $(document).ready(function () {
        $(".SearchRecipesList tr").click(function () {
            $(".SearchRecipesList tr").css("background-color", "#fff");
            $(this).css("background-color", "#999");
            $("#hf_recipesid").val($(this).attr("cid"));
        });
    });
</script>
<!--菜谱库 -->
<script type="text/javascript">
    $(document).ready(function () {
        $("#dialog2").dialog({
            autoOpen: false,
            width: 400,
            buttons: [
                {
                    text: "关闭",
                    click: function () {
                        $(this).dialog("close");
                    }
                }
			]
        });
    });

    /*加载菜谱库*/
    function LoadDish() {
        var RecipesID = '<%=m_recipesid %>';
        if (RecipesID == "") {
            return;
        }
        $.ajax({
            type: "Post",
            url: "shipu_clone05.aspx/Getlibrary",
            data: "{'RecipesID':'" + RecipesID + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data) {
                if (data.d[0] == "OK") {
                    $("#library_list").html(data.d[1]);
                    libraryBing();
                    LoadDishInfo(data.d[2]); //加载菜谱
                    $("#library_Name").text(data.d[3]);
                }
            }
        });
    }

    //绑定食谱库选择事件
    function libraryBing() {
        $("#library_list tr").mouseover(function () {
            $("#library_list tr").css("background-color", "#fff");
            $(this).css("background-color", "#999");
        });

        $("#library_list tr").click(function () {
            dishid = $(this).attr("uid");
            LoadDishInfo($(this).attr("uid"));
            $("#library_Name").text($(this).attr("uname"));
            $("#dialog2").dialog("close");
        });
    }

    function OpenDishRecipes() {
        if (parseInt('<%=m_recipesid %>')<=0) {
            alert("请先选择食谱！");
            return;
        }
        $("#dialog2").dialog("open");
        if ($("#library_list").html() == "") {
            LoadDish();
        }
    }
</script>
<!--参数设置 -->
<script type="text/javascript">
    $(document).ready(
        function () {
//            $("#dialog3>div>dl>dd").each(function (i) {
//                $(this).click((function (k) {
//                    return function () {
//                        $("#dialog3>div>div").hide();
//                        $("#dialog3>div>div:eq(" + k + ")").show();
//                        $("#dialog3>div>dl>dd").removeClass("on");
//                        $("#dialog3>div>dl>dd:eq(" + k + ")").addClass("on");
//                        if (k == 1) SetAutoRecipesParameter();
//                    }
//                })(i));
//            });
        })
        $(function () {
            $("#dialog3,#dialog4").dialog({
                autoOpen: false,
                width: 670
            });
        });

        function ParameterSet() {
            $("#dialog3").dialog("open");
        }

        function OpenAutoRecipesSet() {
            $("#dialog4").dialog("open");
            SetAutoRecipesParameter();
        }

        function SetAutoRecipesParameter() {
            if ($("td[autofood='zaocan']").html() != "") return;
            if ($("td[autofood='wucan']").html() != "") return;
            if ($("td[autofood='wancan']").html() != "") return;
            $.ajax({
                type: "Post",
                url: "shipu_clone05.aspx/GetAutoRecipesParameter",
                data: "",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    if (data.d.length == 4) {
                        $("td[autofood='zaocan']").html(data.d[0]);
                        $("td[autofood='wucan']").html(data.d[1]);
                        $("td[autofood='wancan']").html(data.d[2]);
                    }
                }
            });
        }

        var isaddreparame=true;
        function SaveAutoRecipesParameter() {
            if (!confirm("自动生成食谱将覆盖原有食谱，你确定要自动生成食谱吗？")) return;
            var zc = GetPageAutoRecipesParameter("zaocan");
            var zhc = GetPageAutoRecipesParameter("wucan");
            var wc = GetPageAutoRecipesParameter("wancan");
            var weeknoid = $("#pc_week").val(); //周
            if (!isaddreparame) {
                alert("参数填写错误！");
                return;
            }
            $("#dialog3>div").hide();
            $("#dialog3>div#dialog3_msg").show();
            showwait(10);
            $.ajax({
                type: "Post",
                url: "shipu_clone05.aspx/SaveAutoRecipesParameter",
                data: "{'StrRecipesID':'<%=m_recipesid %>','StrWeekNoID':'" + weeknoid + "','breakfast':'" + zc + "','lunch':'" + zhc + "','dinner':'" + wc + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    if (data.d == "OK") {
                        alert("自动生成成功！");
                        location.href = "shipu_clone05.aspx?cid=<%=m_recipesid %>&weekno=" + weeknoid + "&dishid=" + dishid;
                    }
                    else {
                        alert("自动生成失败！");
                    }
                    $("#dialog3>div").show();
                    $("#dialog3>div#dialog3_msg").hide();
                    closewait();
                }
            });
        }

        function GetPageAutoRecipesParameter(op) {
            var zc = "|";
            $("td[autofood='" + op + "'] dd").each(function () {
                var no = $(this).find("input[autor]").val();
                var id = $(this).find("input[autor]").attr("autor");
                if (CheckID(id, false) && CheckID(no, true)) {
                    zc += id + "," + no + "|";
                }
                else {
                    isaddreparame = false;
                }
            });
            return zc;
        }

        function SaveRecipesRepeatList() {
            var str = "|";
            $("select[typesid]").each(function () {
                var id = $(this).attr("typesid");
                var repeattype = $(this).val();
                var no = $("input[ntypesid='" + id + "']").val();
                str += id + "," + repeattype + "," + no + "|";
            });

            $.ajax({
                type: "Post",
                url: "shipu_clone05.aspx/SaveRecipesRepeatList",
                data: "{'recipes':'<%=m_recipesid %>','str':'" + str + "'}",
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (data) {
                    str = "|";
                    if (data.d == "OK") {
                        alert("保存成功！");
                    }
                }
            });
        }
</script>
<!--日期计算-->
<script type="text/javascript">
    function DateAddDay(str, n) {
        var dd, mm, yy;
        var reg = /^(\d{4})-(\d{1,2})-(\d{1,2})$/;
        if (arr = str.match(reg)) {
            yy = Number(arr[1]);
            mm = Number(arr[2]) - 1;
            dd = Number(arr[3]);
        } else {
            var d = new Date();
            yy = d.getUTCFullYear();
            mm = ("00" + (d.getUTCMonth())).slice(-2);
            dd = ("00" + d.getUTCDate()).slice(-2);
        }
        return SpecifiedDateAddDay(yy, mm, dd, n);
    }

    function SpecifiedDateAddDay(yy, mm, dd, n) {
        var s, d, t, t2;
        t = Date.UTC(yy, mm, dd);
        t2 = n * 1000 * 3600 * 24;
        t += t2;
        d = new Date(t);
        s = d.getUTCFullYear() + "-";
        s += ("00" + (d.getUTCMonth() + 1)).slice(-2) + "-";
        s += ("00" + d.getUTCDate()).slice(-2);
        return s;
    }
</script>
<!--自动调整菜品数量-->
<script type="text/javascript">
    //自动调整本日菜品数量
    function AutoRecipeNum() {
        //if (!confirm("计算后，原有菜品原料数量不可恢复，您确定要计算吗？")) return;
        var weeknoid = $("#pc_week").val(); //周
        var qinrow = $("#pc_j_" + (add_dayofweek == 0 ? 7 : add_dayofweek) + " dt[rawtype='shiwu_3']").attr("rawtypevalue");
        var yuxia = $("#pc_j_" + (add_dayofweek == 0 ? 7 : add_dayofweek) + " dt[rawtype='shiwu_4']").attr("rawtypevalue");
        var shucai = $("#pc_j_" + (add_dayofweek == 0 ? 7 : add_dayofweek) + " dt[rawtype='shiwu_6']").attr("rawtypevalue");
        $.ajax({
            type: "Post",
            url: "shipu_clone05.aspx/AutoUpdateDishNumber",
            data: "{'StrRecipesID':'<%=m_recipesid %>','StrWeekNoID':'" + weeknoid + "','StrDayOfWeek':'" + add_dayofweek + "','StrQinRow':'" + qinrow + "','StrYuXia':'" + yuxia + "','StrShCai':'" + shucai + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data) {
                if (data.d != "") {
                    var o = eval('(' + data.d + ')');
                    var n = 0;
                    $(o.UpdateInfo).each(function () {
                        $("#td[typeid='" + o.UpdateInfo[n].ID + "']").html(o.UpdateInfo[n].Number);
                        n++;
                    });
                    GetRecipesPrice(0);
                    alert("自动调整成功！");
                    location.href = "shipu_clone05.aspx?cid=<%=m_recipesid %>&weekno=" + $('#pc_week').get(0).selectedIndex + "&dishid=" + dishid + "&Rid=" + Math.random();
                }
            }
        });
    }

    function AutoRecipeNumByWeek() {
        if (!confirm("计算后，原有菜品原料数量不可恢复，您确定要计算吗？")) return;
        $("#dialog5").dialog("open");
    }
    //自动调整本周菜品数量
    function ExecAutoRecipeWeek() {
        showwait(5);
        ExecGetRecipesPrice(0); //开始执行
    }

    function ExecAutoRecipeNum(DayOfWeek) {
        var k = (DayOfWeek > 0 ? DayOfWeek : 7);
        var weeknoid = $("#pc_week").val(); //周
        var qinrow = $("#pc_j_" + k + " dt[rawtype='shiwu_3']").attr("rawtypevalue");
        var yuxia = $("#pc_j_" + k + " dt[rawtype='shiwu_4']").attr("rawtypevalue");
        var shucai = $("#pc_j_" + k + " dt[rawtype='shiwu_6']").attr("rawtypevalue");
        if (qinrow == "0" || yuxia == "0" || shucai == "") {
            if (DayOfWeek != 6) {
                ExecAutoRecipeNum(DayOfWeek + 1);  //依次执行到本周最后一天
            }
            else {
                alert("自动调整成功！");
                location.href = "shipu_clone05.aspx?cid=<%=m_recipesid %>&weekno=" + $('#pc_week').get(0).selectedIndex + "&dishid=" + dishid + "&Rid=" + Math.random();
            }
            return;
        }

        $.ajax({
            type: "Post",
            url: "shipu_clone05.aspx/AutoUpdateDishNumber",
            data: "{'StrRecipesID':'<%=m_recipesid %>','StrWeekNoID':'" + weeknoid + "','StrDayOfWeek':'" + DayOfWeek + "','StrQinRow':'" + qinrow + "','StrYuXia':'" + yuxia + "','StrShCai':'" + shucai + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data) {
                if (data.d != "") {
                    if (DayOfWeek == 6) {
                        alert("自动调整成功！");
                        location.href = "shipu_clone05.aspx?cid=<%=m_recipesid %>&weekno=" + $('#pc_week').get(0).selectedIndex + "&dishid=" + dishid + "&Rid=" + Math.random();
                    }
                    else {
                        ExecAutoRecipeNum(DayOfWeek + 1);  //依次执行到本周最后一天
                    }
                }
                else {
                    alert("Error!");
                }
            }
        });
    }

    function ExecGetRecipesPrice(index) {
        var k = (index > 0 ? index : 7);
        var recipeid = "<%=m_recipesid %>";
        var weeknoid = $("#pc_week").val();
        $.ajax({
            type: "Post",
            url: "shipu_clone05.aspx/GetRecipesPrice",
            data: "{'StrRecipesID':'" + recipeid + "','StrWeekNoID':'" + weeknoid + "','StrDayOfWeek':'" + index + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data) {
                $("#recipesprice_" + k).html("");
                $("#recipessafe_" + k).html("");
                $("#pc_j_" + k + " dt[rawtype^='shiwu_']").html("0g");
                if ($(data.d).length == 3) {
                    $("#recipesprice_" + k).html(data.d[0]);
                    $("#recipessafe_" + k).html(data.d[1]);
                    var n = 0;
                    $(data.d[2]).each(function () {
                        $("#pc_j_" + k + " dt[rawtype='shiwu_" + data.d[2][n].Key + "']").attr("rawtypevalue", data.d[2][n].Value);
                        $("#pc_j_" + k + " dt[rawtype='shiwu_" + data.d[2][n].Key + "']").html(data.d[2][n].Value + "g");
                        n++;
                    });
                }
                if (index == 6) { //执行自动调整
                    ExecAutoRecipeNum(0);
                }
                else {
                    ExecGetRecipesPrice(index + 1);
                }
            }
        });
    }

</script>
<!--搜索菜品-->
<script type="text/javascript">
    function SearchKey() {
        var key = $("#Search_txt").val();
        if (key == "") {
            $("#Dish_List a").css("color", "#000").attr("isSelected","false").parent("li").css("display", "block");
            //alert("请输入查询内容！");
            return;
        }
        var libraryID = $("#hf_libraryID").val();
        $("#Dish_List a").css("color", "#000").attr("isSelected", "false").parent("li").css("display", "block");

        $.ajax({
            async:false,
            type: "Post",
            url: "shipu_clone05.aspx/SearchDishByKeyWord",
            data: "{'Lid':'" + libraryID + "','keyWord':'" + key + "'}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function (data) {
                if (data.d[0] == "OK") {
                    var TypeIDS = data.d[1];
                    if (TypeIDS.length > 0) {
                        TypeIDS = "," + TypeIDS + ",";
                        $("#Dish_List a[IsCai='false']").each(function () {
                            if (TypeIDS.indexOf("," + $(this).attr("typeid") + ",") > -1) {
                                $(this).css("color", "red").attr("isSelected", "true").parentsUntil("#Dish_List").prev().css("color", "red").attr("isSelected", "true");
                            }
                        });

                    }
                }
            }
        });

        if (key != null && key.length != 0) {
            $("#Dish_List a:contains('" + key + "')").css("color", "red").attr("isSelected", "true").parentsUntil("#Dish_List").prev().css("color", "red").attr("isSelected", "true");
        }
        $("#Dish_List a[isSelected='false']").parent("li").css("display", "none");
    }
</script>
<body>
    <form id="form1" runat="server">
    <asp:HiddenField ID="hf_daybyweek" runat="server" Value="<%=m_daybyweek %>" />
    <asp:HiddenField ID="hf_weekstart" runat="server" Value="<%=m_weekstart %>" />
    <asp:HiddenField ID="hf_weekend" runat="server" Value="<%=m_weekend %>" />
    <asp:HiddenField ID="hf_recipesid" runat="server" Value="<%=m_recipesid %>" />
    <asp:HiddenField ID="hf_weekNo" runat="server" />
    <asp:HiddenField ID="hf_libraryID" runat="server" /> <!--菜谱ID-->
    <asp:HiddenField ID="HidHtmlTableJson" runat="server" Value="" /> <!--导出Execl-->
    <asp:Button ID="Recipes_List" runat="server" Style="display: none" onclick="Recipes_List_Click" />
    <asp:Button ID="Btn_ExportRecipes" runat="server" Style="display: none" OnClick="Btn_ExportRecipes_Click" />
    <div id="cai_info">
    </div>
    <div class="nav_2">
        <div class="nav_2_1"><img src="../../../Images/nav2_bg1.gif" /></div>
        <ul>
            <li><a href="javascript:void(0);"><span id="span_peic_1" class="feise_border">1.配餐人群设置</span></a></li>
            <li><a href="javascript:void(0);"><span id="span_peic_2" class="feise_border">2.选择配餐日期</span></a></li>
            <li style="background: none"><a href="javascript:void(0);"> <span id="span_peic_3" class="lvse_border">3.生成食谱</span></a></li>
        </ul>
        <div class="nav_2_3"><img src="../../../Images/nav2_bg2.gif" /></div>
    </div>
    <div class="Center_Content">
        <div class="Create_Recipe">
            <div class="left_CR">
                <div class="Recipe_0206" style="margin-bottom:8px;">
                    <h1><a href="javascript:OpenDishRecipes()">选择菜谱</a></h1>
                    <div class="Dl_div" style="height:auto">
                    <h2 id="library_Name">菜谱</h2>
                    <div id="DishList">
                        <div style="width: 175px; height:400px; overflow: auto;">
                            <ul style="float: left; height: 100%;" class="filetree treeview">
                                <li class="open"><a>菜肴<label id="dishNum"></label></a>
                                    <ul id="Dish_List"></ul>
                                </li>
                            </ul>
                        </div>
                    </div>
                    <div class="soso_lt">
                        <table width="100%" border="0" cellspacing="0" cellspacing="0">
                            <tr>
                                <td height="28" align="center" width="150"><input id="Search_txt" type="text" class="input_bg" style="width:140px;" /></td>
                                <td><input id="Search_btn" type="button" onclick="SearchKey()" class="button_soso_lt" style=" margin:0px;" /></td>
                            </tr>
                        </table>
                    </div>
                    </div>
                </div>
            </div>
            <div style="border: 1px solid #044E94; width: 800px; float: right;">
                <div class="r_info">
                    <table>
                    <tr>
                        <td width="10"></td>
                        <td><span>配餐人群：</span><%=pc_person%></td>
                        <td><span>周：</span><asp:DropDownList ID="pc_week" runat="server" style="vertical-align:middle;"></asp:DropDownList></td>
                        <td><span>配餐周期：</span><%=pc_zhouqi%></td>
                        <td width="10"></td>
                    </tr>
                    <tr>
                        <td width="10"></td>
                        <td><span>所属班组：</span><%=pc_class%></td>
                        <td><span>人数：</span><%=pc_number%></td>
                        <td>
                            <div style="float:left;"><a href="javascript:ImportRecipes()" class="input_btn_a">导入食谱</a></div>
                            <%if (m_recipesid > 0 && m_canedit==1)
                              { %>
                              <div style="float:left; margin-left:20px;">
                                <a href="javascript:ParameterSet()" class="input_btn_a">重复率设置</a>
                              </div>
                              <div style="float:left; margin-left:20px;">
                                <a href="javascript:OpenAutoRecipesSet()" class="input_btn_a">自动生成食谱</a>
                              </div>
                              <div style="float:left; margin-left:20px;">
                                <a href="javascript:CopyRecipes()" class="input_btn_a">复制食谱</a>
                              </div>
                              <div style="float:left; margin-left:20px;">
                                <a href="javascript:GetHtmlTableJson('RecipesTable')" class="input_btn_a">导出Execl</a>
                              </div>
                            <%} %>
                        </td>
                        <td width="10"></td>
                    </tr>
                </table>
                </div>
                <div id="pc_ui">
                    <ul>
                        <li id="pc_t0">全部</li>
                        <li id="pc_t1">星期一</li>
                        <li id="pc_t2">星期二</li>
                        <li id="pc_t3">星期三</li>
                        <li id="pc_t4" class="on">星期四</li>
                        <li id="pc_t5">星期五</li>
                        <li id="pc_t6">星期六</li>
                        <li id="pc_t7">星期日</li>
                    </ul>
                    <div id="pc_box" style="clear: both;">
                        <div id="pc_tab0">
                            <table class="pc_l" cellpadding="0" cellspacing="0" border="1" id="RecipesTable">
                                <thead>
                                    <tr>
                                        <th>
                                            餐别
                                        </th>
                                        <th>
                                            星期一(Monday)
                                        </th>
                                        <th>
                                            星期二(Tuesday)
                                        </th>
                                        <th>
                                            星期三(Wednesday)
                                        </th>
                                        <th>
                                            星期四(Thursday)
                                        </th>
                                        <th>
                                            星期五(Friday)
                                        </th>
                                        <th>
                                            星期六(Saturday)
                                        </th>
                                        <th>
                                            星期日(Sunday)
                                        </th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr>
                                        <th>
                                            早餐
                                        </th>
                                        <td valign="top">
                                        </td>
                                        <td valign="top">
                                        </td>
                                        <td valign="top">
                                        </td>
                                        <td valign="top">
                                        </td>
                                        <td valign="top">
                                        </td>
                                        <td valign="top">
                                        </td>
                                        <td valign="top">
                                        </td>
                                    </tr>
                                    <tr>
                                        <th>
                                            上午茶
                                        </th>
                                        <td valign="top">
                                        </td>
                                        <td valign="top">
                                        </td>
                                        <td valign="top">
                                        </td>
                                        <td valign="top">
                                        </td>
                                        <td valign="top">
                                        </td>
                                        <td valign="top">
                                        </td>
                                        <td valign="top">
                                        </td>
                                    </tr>
                                    <tr>
                                        <th>
                                            午餐
                                        </th>
                                        <td valign="top">
                                        </td>
                                        <td valign="top">
                                        </td>
                                        <td valign="top">
                                        </td>
                                        <td valign="top">
                                        </td>
                                        <td valign="top">
                                        </td>
                                        <td valign="top">
                                        </td>
                                        <td valign="top">
                                        </td>
                                    </tr>
                                    <tr>
                                        <th>
                                            下午茶
                                        </th>
                                        <td valign="top">
                                        </td>
                                        <td valign="top">
                                        </td>
                                        <td valign="top">
                                        </td>
                                        <td valign="top">
                                        </td>
                                        <td valign="top">
                                        </td>
                                        <td valign="top">
                                        </td>
                                        <td valign="top">
                                        </td>
                                    </tr>
                                    <tr>
                                        <th>
                                            晚餐
                                        </th>
                                        <td valign="top">
                                        </td>
                                        <td valign="top">
                                        </td>
                                        <td valign="top">
                                        </td>
                                        <td valign="top">
                                        </td>
                                        <td valign="top">
                                        </td>
                                        <td valign="top">
                                        </td>
                                        <td valign="top">
                                        </td>
                                    </tr>
                                    <tr>
                                        <th>
                                            夜餐
                                        </th>
                                        <td valign="top">
                                        </td>
                                        <td valign="top">
                                        </td>
                                        <td valign="top">
                                        </td>
                                        <td valign="top">
                                        </td>
                                        <td valign="top">
                                        </td>
                                        <td valign="top">
                                        </td>
                                        <td valign="top">
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                        <div id="pc_tab1" class="pc_tab">
                            <div id="pc_x1" class="pc_x">
                                <table class="pc_l" width="100%" cellpadding="0" cellspacing="0" border="1">
                                    <thead>
                                        <tr>
                                            <th>
                                                餐别
                                            </th>
                                            <th>
                                                星期一(Monday)
                                            </th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr istz='true' fmid='1'>
                                            <td align="center">
                                                早餐
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                        <tr istz='true' fmid='5'>
                                            <td align="center">
                                                上午茶
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                        <tr istz='true' fmid='2'>
                                            <td align="center">
                                                午餐
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                        <tr istz='true' fmid='6'>
                                            <td align="center">
                                                下午茶
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                        <tr istz='true' fmid='3'>
                                            <td align="center">
                                                晚餐
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                            <div id="pc_j_1" class="pc_j">
                                 <%if (m_recipesid > 0 && m_canedit == 1)
                                   { %><input type="button" class="autonum" onclick="AutoRecipeNumByWeek()" value="" /><%} %>
                                <input type="button" class="chakan" value="" onclick="opendrag(1)" />
                                <div class="shiwu" id="shiwu">
                                    <h2 class="swly"></h2>                                    
                                    <div style="clear:both; margin:0px; padding:0px;">
                                    <div class="shiwu_left">
                                        <%=m_shiwuzhongsh %>
                                    </div>
                                    <div class="shiwu_right">
                                        <img src="../../../Images/ssbt.jpg" width="283" height="241" />
                                    </div>
                                    </div>
                                </div>
                                <div class="clear_div" style="height:0px; width:400px;"></div>
                                <h2 class="jjpj"></h2>
                                <div id="recipesprice_1">
                            
                                </div>
                                <h2 class="aqts"></h2>
                                <div id="recipessafe_1">
                            
                                </div>
                            </div>
                        </div>
                        <div id="pc_tab2" class="pc_tab">
                            <div id="pc_x2" class="pc_x">
                                <table class="pc_l" width="100%" cellpadding="0" cellspacing="0" border="1">
                                    <thead>
                                        <tr>
                                            <th>
                                                餐别
                                            </th>
                                            <th>
                                                星期二(Tuesday)
                                            </th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr istz='true' fmid='1'>
                                            <td align="center">
                                                早餐
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                        <tr istz='true' fmid='5'>
                                            <td align="center">
                                                上午茶
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                        <tr istz='true' fmid='2'>
                                            <td align="center">
                                                午餐
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                        <tr istz='true' fmid='6'>
                                            <td align="center">
                                                下午茶
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                        <tr istz='true' fmid='3'>
                                            <td align="center">
                                                晚餐
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                            <div id="pc_j_2" class="pc_j">
                             <%if (m_recipesid > 0 && m_canedit == 1)
                               { %>
                                <input type="button" class="autonum" onclick="AutoRecipeNumByWeek()" value="" /><%} %>
                                <input type="button" class="chakan" value="" onclick="opendrag(2)" />
                                <div class="shiwu" id="Div1">
                                    <h2 class="swly"></h2>
                                    <div style="clear:both; margin:0px; padding:0px;">
                                    <div class="shiwu_left">
                                        <%=m_shiwuzhongsh %>
                                    </div>
                                    <div class="shiwu_right">
                                        <img src="../../../Images/ssbt.jpg" width="283" height="241" />
                                    </div>
                                    </div>
                                </div>
                                <h2 class="jjpj"></h2>
                                <div id="recipesprice_2">
                            
                                </div>
                                <h2 class="aqts"></h2>
                                <div id="recipessafe_2">
                            
                                </div>
                            </div>
                        </div>
                        <div id="pc_tab3" class="pc_tab">
                            <div id="pc_x3" class="pc_x">
                                <table class="pc_l" width="100%" cellpadding="0" cellspacing="0" border="1">
                                    <thead>
                                        <tr>
                                            <th>
                                                餐别
                                            </th>
                                            <th>
                                                星期三(Wednesday)
                                            </th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr istz='true' fmid='1'>
                                            <td align="center">
                                                早餐
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                        <tr istz='true' fmid='5'>
                                            <td align="center">
                                                上午茶
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                        <tr istz='true' fmid='2'>
                                            <td align="center">
                                                午餐
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                        <tr istz='true' fmid='6'>
                                            <td align="center">
                                                下午茶
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                        <tr istz='true' fmid='3'>
                                            <td align="center">
                                                晚餐
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                            <div id="pc_j_3" class="pc_j">
                             <%if (m_recipesid > 0 && m_canedit == 1)
                               { %>
                                <input type="button" class="autonum" onclick="AutoRecipeNumByWeek()" value="" />
                                <%} %>
                                <input type="button" class="chakan" value="" onclick="opendrag(3)" />
                                <div class="shiwu" id="Div2">
                                    <h2 class="swly"></h2>
                                    <div style="clear:both; margin:0px; padding:0px;">
                                    <div class="shiwu_left">
                                        <%=m_shiwuzhongsh %>
                                    </div>
                                    <div class="shiwu_right">
                                        <img src="../../../Images/ssbt.jpg" width="283" height="241" />
                                    </div>
                                    </div>
                                </div>
                                <h2 class="jjpj"></h2>
                                <div id="recipesprice_3">
                            
                                </div>
                                <h2 class="aqts"></h2>
                                <div id="recipessafe_3">
                            
                                </div>
                            </div>
                        </div>
                        <div id="pc_tab4" class="pc_tab">
                            <div id="pc_x4" class="pc_x">
                                <table class="pc_l" width="100%" cellpadding="0" cellspacing="0" border="1">
                                    <thead>
                                        <tr>
                                            <th>
                                                餐别
                                            </th>
                                            <th>
                                                星期四(Thursday)
                                            </th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr istz='true' fmid='1'>
                                            <td align="center">
                                                早餐
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                        <tr istz='true' fmid='5'>
                                            <td align="center">
                                                上午茶
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                        <tr istz='true' fmid='2'>
                                            <td align="center">
                                                午餐
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                        <tr istz='true' fmid='6'>
                                            <td align="center">
                                                下午茶
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                        <tr istz='true' fmid='3'>
                                            <td align="center">
                                                晚餐
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                            <div id="pc_j_4" class="pc_j">
                             <%if (m_recipesid > 0 && m_canedit == 1)
                               { %>
                                <input type="button" class="autonum" onclick="AutoRecipeNumByWeek()" value="" />
                                <%} %>
                                <input type="button" class="chakan" value="" onclick="opendrag(4)" />
                                <div class="shiwu" id="Div3">
                                    <h2 class="swly"></h2>
                                    <div style="clear:both; margin:0px; padding:0px;">
                                    <div class="shiwu_left">
                                        <%=m_shiwuzhongsh %>
                                    </div>
                                    <div class="shiwu_right">
                                        <img src="../../../Images/ssbt.jpg" width="283" height="241" />
                                    </div>
                                    </div>
                                </div>
                                <h2 class="jjpj"></h2>
                                <div id="recipesprice_4">
                            
                                </div>
                                <h2 class="aqts"></h2>
                                <div id="recipessafe_4">
                            
                                </div>
                            </div>
                        </div>
                        <div id="pc_tab5" class="pc_tab">
                            <div id="pc_x5" class="pc_x">
                                <table class="pc_l" width="100%" cellpadding="0" cellspacing="0" border="1">
                                    <thead>
                                        <tr>
                                            <th>
                                                餐别
                                            </th>
                                            <th>
                                                星期五(Friday)
                                            </th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr istz='true' fmid='1'>
                                            <td align="center">
                                                早餐
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                        <tr istz='true' fmid='5'>
                                            <td align="center">
                                                上午茶
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                        <tr istz='true' fmid='2'>
                                            <td align="center">
                                                午餐
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                        <tr istz='true' fmid='6'>
                                            <td align="center">
                                                下午茶
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                        <tr istz='true' fmid='3'>
                                            <td align="center">
                                                晚餐
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                            <div id="pc_j_5" class="pc_j">
                                 <%if (m_recipesid > 0 && m_canedit == 1)
                                   { %>
                                <input type="button" class="autonum" onclick="AutoRecipeNumByWeek()" value="" />
                                <%} %>
                                <input type="button" class="chakan" value="" onclick="opendrag(5)" />
                                <div class="shiwu" id="Div4">
                                    <h2 class="swly"></h2>
                                    <div style="clear:both; margin:0px; padding:0px;">
                                    <div class="shiwu_left">
                                        <%=m_shiwuzhongsh %>
                                    </div>
                                    <div class="shiwu_right">
                                        <img src="../../../Images/ssbt.jpg" width="283" height="241" />
                                    </div>
                                    </div>
                                </div>
                                <h2 class="jjpj"></h2>
                                <div id="recipesprice_5">
                            
                                </div>
                                <h2 class="aqts"></h2>
                                <div id="recipessafe_5">
                            
                                </div>
                            </div>
                        </div>
                        <div id="pc_tab6" class="pc_tab">
                            <div id="pc_x6" class="pc_x">
                                <table class="pc_l" width="100%" cellpadding="0" cellspacing="0" border="1">
                                    <thead>
                                        <tr>
                                            <th>
                                                餐别
                                            </th>
                                            <th>
                                                星期六(Saturday)
                                            </th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr istz='true' fmid='1'>
                                            <td align="center">
                                                早餐
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                        <tr istz='true' fmid='5'>
                                            <td align="center">
                                                上午茶
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                        <tr istz='true' fmid='2'>
                                            <td align="center">
                                                午餐
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                        <tr istz='true' fmid='6'>
                                            <td align="center">
                                                下午茶
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                        <tr istz='true' fmid='3'>
                                            <td align="center">
                                                晚餐
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                            <div id="pc_j_6" class="pc_j">
                                 <%if (m_recipesid > 0 && m_canedit == 1)
                                   { %>
                                <input type="button" class="autonum" onclick="AutoRecipeNumByWeek()" value="" /><%} %>
                                <input type="button" class="chakan" value="" onclick="opendrag(6)" />
                                <div class="shiwu" id="Div5">
                                    <h2 class="swly"></h2>
                                    <div style="clear:both; margin:0px; padding:0px;">
                                    <div class="shiwu_left">
                                        <%=m_shiwuzhongsh %>
                                    </div>
                                    <div class="shiwu_right">
                                        <img src="../../../Images/ssbt.jpg" width="283" height="241" />
                                    </div>
                                    </div>
                                </div>
                                <h2 class="jjpj"></h2>
                                <div id="recipesprice_6">
                            
                                </div>
                                <h2 class="aqts"></h2>
                                <div id="recipessafe_6">
                            
                                </div>
                            </div>
                        </div>
                        <div id="pc_tab7" class="pc_tab">
                            <div id="pc_x7" class="pc_x">
                                <table class="pc_l" width="100%" cellpadding="0" cellspacing="0" border="1">
                                    <thead>
                                        <tr>
                                            <th>
                                                餐别
                                            </th>
                                            <th>
                                                星期日(Sunday)
                                            </th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr istz='true' fmid='1'>
                                            <td align="center">
                                                早餐
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                        <tr istz='true' fmid='5'>
                                            <td align="center">
                                                上午茶
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                        <tr istz='true' fmid='2'>
                                            <td align="center">
                                                午餐
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                        <tr istz='true' fmid='6'>
                                            <td align="center">
                                                下午茶
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                        <tr istz='true' fmid='3'>
                                            <td align="center">
                                                晚餐
                                            </td>
                                            <td>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                            <div id="pc_j_7" class="pc_j">
                             <%if (m_recipesid > 0 && m_canedit == 1)
                               { %>
                                <input type="button" class="autonum" onclick="AutoRecipeNumByWeek()" value="" /><%} %>
                                <input type="button" class="chakan" value="" onclick="opendrag(7)" />
                                <div class="shiwu" id="Div6">
                                    <h2 class="swly"></h2>
                                    <div style="clear:both; margin:0px; padding:0px;">
                                    <div class="shiwu_left">
                                        <%=m_shiwuzhongsh %>
                                    </div>
                                    <div class="shiwu_right">
                                        <img src="../../../Images/ssbt.jpg" width="283" height="241" />
                                    </div>
                                    </div>
                                </div>
                                <h2 class="jjpj"></h2>
                                <div id="recipesprice_7">
                            
                                </div>
                                <h2 class="aqts"></h2>
                                <div id="recipessafe_7">
                            
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    </form>
    <div id="dialog" title="元素含量信息">
        <div id="e_main">
            <ul id="ys_title_ui">
                <li ui='0' class="on">全天</li><li ui='1'>早餐</li><li ui='2'>午餐</li><li ui='3'>晚餐</li>
            </ul>
            <div id="ys_container_ui_0" class="ys_container_ui">
                <table width="440" cellpadding="0" cellspacing="0">
                    <thead>
                        <tr>
                            <th rowspan="2" width="140">营养素摄入量</th>
                            <th rowspan="2" width="100">标准推荐量</th>
                            <th colspan="2">周平均</th>
                            <th colspan="2" name='riqi'>2012/3/5</th>
                        </tr>
                        <tr>
                            <th width="50">实际</th>
                            <th width="50">比率%</th>
                            <th width="50">实际</th>
                            <th width="50">比率%</th>
                        </tr>
                    </thead>
                    <tbody></tbody>
                </table>
            </div>
            <div id="ys_container_ui_1" class="ys_container_ui">
                <table width="440" cellpadding="0" cellspacing="0">
                    <thead>
                        <tr>
                            <th rowspan="2" width="140">营养素摄入量</th>
                            <th rowspan="2" width="100">标准推荐量</th>
                            <th colspan="2">周平均</th>
                            <th colspan="2" name='riqi'>2012/3/5</th>
                        </tr>
                        <tr>
                            <th width="50">实际</th>
                            <th width="50">比率%</th>
                            <th width="50">实际</th>
                            <th width="50">比率%</th>
                        </tr>
                    </thead>
                    <tbody></tbody>
                </table>
            </div>
            <div id="ys_container_ui_2" class="ys_container_ui">
                <table width="440" cellpadding="0" cellspacing="0">
                    <thead>
                        <tr>
                            <th rowspan="2" width="140">营养素摄入量</th>
                            <th rowspan="2" width="100">标准推荐量</th>
                            <th colspan="2">周平均</th>
                            <th colspan="2" name='riqi'>2012/3/5</th>
                        </tr>
                        <tr>
                            <th width="50">实际</th>
                            <th width="50">比率%</th>
                            <th width="50">实际</th>
                            <th width="50">比率%</th>
                        </tr>
                    </thead>
                    <tbody></tbody>
                </table>
            </div>
            <div id="ys_container_ui_3" class="ys_container_ui">
                <table width="440" cellpadding="0" cellspacing="0">
                    <thead>
                        <tr>
                            <th rowspan="2" width="140">营养素摄入量</th>
                            <th rowspan="2" width="100">标准推荐量</th>
                            <th colspan="2">周平均</th>
                            <th colspan="2" name='riqi'>2012/3/5</th>
                        </tr>
                        <tr>
                            <th width="50">实际</th>
                            <th width="50">比率%</th>
                            <th width="50">实际</th>
                            <th width="50">比率%</th>
                        </tr>
                    </thead>
                    <tbody></tbody>
                </table>
            </div>
        </div>
    </div>

    <div id="dialog1" title="导入食谱" style="padding:0px;">
        <div style="height:25px; line-height:25px; padding:5px 0px 5px 10px;">
            <table border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td>食谱名称：</td>
                    <td><input type="text" id="txt_RecipesName" value="" style="width:90px;" /></td>
                    <td>&nbsp;&nbsp;时间范围：</td>
                    <td><input type="text" id="txt_RecipesStartTime" value="" onclick="WdatePicker()" style="width:90px;" /></td>
                    <td>至</td>
                    <td><input type="text" id="txt_RecipesEndTime" value=""  onclick="WdatePicker()"  style="width:90px;"/></td>
                    <td style="padding-left:10px;"><input type="button" id="btn_RecipesSearch" value="查询" class="input_btn_a" onclick="SearchRecipe('')" /></td>
                </tr>
            </table>
        </div>

        <style type="text/css">
            .RecipesTab{ width:100%;height:31px;border-bottom:1px solid #044E94;}
            .RecipesTab li{ float:left; padding-right:10px;}
            .RecipesTab li a{ display:block; width:100px; height:30px; text-align:center; line-height:30px; border:1px solid #044E94; border-bottom:1px; background-color:#D9E8FB;}
            .RecipesTab .curr{ background-color:#fff; border-bottom:0px; color:#fff;  background-color:#f90; }
        </style>

        <div class="RecipesTab RecipesTabImp">
            <ul>
                <li><a href="javascript:void(0);" class="curr" id="RecipesTab_1" onclick="ShowDivList('1','Imp')">标准食谱</a></li>
                <li><a href="javascript:void(0);" id="RecipesTab_2"  onclick="ShowDivList('2','Imp')">本班组食谱</a></li>
            </ul>
        </div>

        <div style="height: 300px; overflow-y: auto;" id="RecipesList_1" class="HidDivListImp display_block">
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="swxx_table">
                <thead>
                    <tr>
                        <td width="130">名称</td>
                        <td width="100">周期</td>
                        <td width="100">配餐起始时间</td>
                        <td width="100">配餐截至时间</td>
                    </tr>
                </thead>
                <tbody id="shipuList" class="SearchRecipesList">
                    <asp:Repeater ID="Rep_shipuList" runat="server">
                        <ItemTemplate>
                            <tr cid="<%#Eval("id")%>" RecipesName="<%#Eval("CateringName")%>" StartTime="<%#Convert.ToDateTime(Eval("StateDate")).ToShortDateString()%>" EndTime="<%#Convert.ToDateTime(Eval("StopDate")).ToShortDateString()%>">
                                <td>
                                    <%#Eval("CateringName")%>
                                </td>
                                <td>
                                    <select name="shipu_zouList">
                                        <%#GetZhouOptionByRid(Eval("id").ToString())%>
                                    </select>
                                </td>
                                <td>
                                    <%#Convert.ToDateTime(Eval("StateDate")).ToShortDateString()%>
                                </td>
                                <td>
                                    <%#Convert.ToDateTime(Eval("StopDate")).ToShortDateString()%>
                                </td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                </tbody>
            </table>
        </div>

        <div style="height: 300px; overflow-y: auto;" id="RecipesList_2" class="HidDivListImp display_none">
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="swxx_table">
                <thead>
                    <tr>
                        <td width="130">名称</td>
                        <td width="100">周期</td>
                        <td width="100">配餐起始时间</td>
                        <td width="100">配餐截至时间</td>
                    </tr>
                </thead>
                <tbody id="shipuList" class="SearchRecipesList">
                    <asp:Repeater ID="Rep_shipuListByClass" runat="server">
                        <ItemTemplate>
                            <tr cid="<%#Eval("id")%>" RecipesName="<%#Eval("CateringName")%>" StartTime="<%#Convert.ToDateTime(Eval("StateDate")).ToShortDateString()%>" EndTime="<%#Convert.ToDateTime(Eval("StopDate")).ToShortDateString()%>">
                                <td>
                                    <%#Eval("CateringName")%>
                                </td>
                                <td>
                                    <select name="shipu_zouList">
                                        <%#GetZhouOptionByRid(Eval("id").ToString())%>
                                    </select>
                                </td>
                                <td>
                                    <%#Convert.ToDateTime(Eval("StateDate")).ToShortDateString()%>
                                </td>
                                <td>
                                    <%#Convert.ToDateTime(Eval("StopDate")).ToShortDateString()%>
                                </td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                </tbody>
            </table>
        </div>
    </div>

    <div id="dialog2" title="菜谱库">
        <div style="height: 200px; overflow-y: auto;">
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="swxx_table">
                <thead>
                    <tr>
                        <td style="width: 50px">
                            序号
                        </td>
                        <td style="width: 150px">
                            菜谱库名称
                        </td>
                        <td style="width: 250px">
                            备注
                        </td>
                    </tr>
                </thead>
                <tbody id="library_list"></tbody>
            </table>
        </div>
    </div>
    <div id="dialog3" title="周食谱重复率设置">
        <div style="height:370px; overflow-y: auto;">
            <div>
                <div class="tp_list">
                    <%=m_DishTypesList%>
                </div>
                <table align="right">
                    <tr>
                        <td height="50"><a class="input_btn_a" href="javascript:SaveRecipesRepeatList()">保存</a></td>
                        <td width="10"></td>
                    </tr>
                </table>
            </div>
        </div>
    </div>
    <div id="dialog4" title="自动生成食谱">
        <div style="height: 370px; overflow-y: auto;">
        <div>
                <div style="width:614px; border:1px solid #000; height:308px; overflow:auto; margin:0px auto;">
                    <table width="597">
                        <tr>
                            <td height="30" style="background-color:#D9E8FB; border-top:1px solid #c8dbf2; color:#044D93; font-weight:bold;" colspan="8">能量分配比例</td>
                        </tr>
                        <tr>
                            <td height="30" width="45" align="right";>早餐：</td><td><input type="text" style="width:50px;" disabled="disabled" value="3" /></td>
                            <td width="45" align="right";>午餐：</td><td><input type="text" style="width:50px;" disabled="disabled" value="4" /></td>
                            <td width="45" align="right";>晚餐：</td><td><input type="text" style="width:50px;" disabled="disabled" value="3" /></td>
                        </tr>
                        <tr>
                            <td height="30" style="background-color:#D9E8FB; color:#044D93; border-top:1px solid #c8dbf2; font-weight:bold;" colspan="8">菜品种数分类</td>
                        </tr>
                        <tr>
                            <td height="24" colspan="8" style="background-color:#EBF5FE; border-top:1px solid #c3daef;" colspan="8">早餐：</td>
                        </tr>
                        <tr>
                            <td colspan="8" autofood='zaocan'></td>
                        </tr>
                        <tr>
                            <td height="24" colspan="8" style="background-color:#EBF5FE; border-top:1px solid #c3daef;" colspan="8">午餐：</td>
                        </tr>
                        <tr>
                            <td colspan="8" autofood='wucan'></td>
                        </tr>
                        <tr>
                            <td height="24" colspan="8" style="background-color:#EBF5FE; border-top:1px solid #c3daef;" colspan="8">晚餐：</td>
                        </tr>
                        <tr>
                            <td colspan="8" autofood='wancan'></td>
                        </tr>
                    </table>
                </div>
                <table align="right">
                    <tr>
                        <td height="50"><a class="input_btn_a" href="javascript:SaveAutoRecipesParameter()">保存</a></td>
                        <td width="10"></td>
                    </tr>
                </table>
            </div>
        </div>
        <div style="height: 370px; display:none; font-size:14px; text-align:center; line-height:370px; vertical-align:middle; font-weight:bold; " id="dialog4_msg">
            正在生成食谱，请稍后！
        </div>
    </div>
    <div id="dialog5" title="选择计算范围">
        <table border="0" cellpadding="0" cellspacing="0" width="100%" style="margin-top:20px;">
            <tr>
                <td align="right"><input id="AutoWeek" class="input_btn_a" type="button" value="本周" onclick="ExecAutoRecipeWeek()" style="margin-right:5px;" /></td>
                <td align="left"><input id="AutoDay"  class="input_btn_a" type="button" value="本日"  onclick="AutoRecipeNum()"  style="margin-left:5px;"/></td>
            </tr>
        </table>
    </div>
    <!--复制食谱-->
    <div id="dialog6" title="复制食谱" style="padding:0px;">
        <div style="height:25px; line-height:25px; padding:5px 0px 5px 10px;">
            <table border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td>食谱名称：</td>
                    <td><input type="text" id="txt_RecipesNameCopy" value="" style="width:90px;" /></td>
                    <td>&nbsp;&nbsp;时间范围：</td>
                    <td><input type="text" id="txt_RecipesStartTimeCopy" value="" onclick="WdatePicker()" style="width:90px;" /></td>
                    <td>至</td>
                    <td><input type="text" id="txt_RecipesEndTimeCopy" value=""  onclick="WdatePicker()"  style="width:90px;"/></td>
                    <td style="padding-left:10px;"><input type="button" id="Button1" value="查询" class="input_btn_a" onclick="SearchRecipe('Copy')" /></td>
                </tr>
            </table>
        </div>

        <style type="text/css">
            .RecipesTab{ width:100%;height:31px;border-bottom:1px solid #044E94;}
            .RecipesTab li{ float:left; padding-right:10px;}
            .RecipesTab li a{ display:block; width:100px; height:30px; text-align:center; line-height:30px; border:1px solid #044E94; border-bottom:1px; background-color:#D9E8FB;}
            .RecipesTab .curr{ background-color:#fff; border-bottom:0px; color:#fff;  background-color:#f90; }
        </style>

        <div class="RecipesTab RecipesTabCopy">
            <ul>
                <li><a href="javascript:void(0);" class="curr" id="RecipesTab_3" onclick="ShowDivList('3','Copy')">标准食谱</a></li>
                <li><a href="javascript:void(0);" id="RecipesTab_4"  onclick="ShowDivList('4','Copy')">本班组食谱</a></li>
            </ul>
        </div>

        <div style="height: 300px; overflow-y: auto;" id="RecipesList_3" class="HidDivListCopy display_block">
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="swxx_table">
                <thead>
                    <tr>
                        <td width="130">名称</td>
                        <td width="100">周期</td>
                        <td width="100">配餐起始时间</td>
                        <td width="100">配餐截至时间</td>
                    </tr>
                </thead>
                <tbody id="CopyRecipesList" class="SearchRecipesListCopy">
                    <asp:Repeater ID="Rep_CopyRecipesList" runat="server">
                        <ItemTemplate>
                            <tr RecipesID="<%#Eval("id")%>" RecipesName="<%#Eval("CateringName")%>" StartTime="<%#Convert.ToDateTime(Eval("StateDate")).ToShortDateString()%>" EndTime="<%#Convert.ToDateTime(Eval("StopDate")).ToShortDateString()%>">
                                <td>
                                    <%#Eval("CateringName")%>
                                </td>
                                <td>
                                    <select name="shipu_zouList">
                                        <%#GetZhouOptionByRid(Eval("id").ToString())%>
                                    </select>
                                </td>
                                <td>
                                    <%#Convert.ToDateTime(Eval("StateDate")).ToShortDateString()%>
                                </td>
                                <td>
                                    <%#Convert.ToDateTime(Eval("StopDate")).ToShortDateString()%>
                                </td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                </tbody>
            </table>
        </div>

        <div style="height: 300px; overflow-y: auto;" id="RecipesList_4" class="HidDivListCopy display_none">
            <table width="100%" border="0" cellspacing="0" cellpadding="0" class="swxx_table">
                <thead>
                    <tr>
                        <td width="130">名称</td>
                        <td width="100">周期</td>
                        <td width="100">配餐起始时间</td>
                        <td width="100">配餐截至时间</td>
                    </tr>
                </thead>
                <tbody id="CopyRecipesList"  class="SearchRecipesListCopy">
                    <asp:Repeater ID="Rep_CopyRecipesListByClass" runat="server">
                        <ItemTemplate>
                            <tr RecipesID="<%#Eval("id")%>" RecipesName="<%#Eval("CateringName")%>" StartTime="<%#Convert.ToDateTime(Eval("StateDate")).ToShortDateString()%>" EndTime="<%#Convert.ToDateTime(Eval("StopDate")).ToShortDateString()%>">
                                <td>
                                    <%#Eval("CateringName")%>
                                </td>
                                <td>
                                    <select name="shipu_zouList">
                                        <%#GetZhouOptionByRid(Eval("id").ToString())%>
                                    </select>
                                </td>
                                <td>
                                    <%#Convert.ToDateTime(Eval("StateDate")).ToShortDateString()%>
                                </td>
                                <td>
                                    <%#Convert.ToDateTime(Eval("StopDate")).ToShortDateString()%>
                                </td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                </tbody>
            </table>
        </div>

    </div>

</body>
</html>
